package com.zzyl.serve.controller.member;

import com.zzyl.common.core.controller.BaseController;
import com.zzyl.common.core.domain.AjaxResult;
import com.zzyl.common.core.page.TableDataInfo;
import com.zzyl.serve.domain.NursingProject;
import com.zzyl.serve.domain.OrdersPage;
import com.zzyl.serve.domain.PageResult;
import com.zzyl.serve.service.INursingProjectService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * @author huangqin
 */
@RestController
@Api(tags = "服务项")
@RequestMapping("/member/orders")
public class MemberOrdersController extends BaseController {
	@Autowired
	private INursingProjectService nursingProjectService;
	/**
 	* 1.1 分页查询护理项目列表
 	* - 请求路径：/member/orders/project/page
	 * - 请求方式：GET
 	*/
	@GetMapping("/project/page")
	@ApiOperation("分页查询护理项目列表")
	public TableDataInfo OrderPage1(OrdersPage ordersPage){
		PageResult pageResult = nursingProjectService.OrderPage1(ordersPage);
//		AjaxResult ajaxResult = new AjaxResult();
//		ajaxResult.put("rows", pageResult.getRows());
//		ajaxResult.put("total", pageResult.getTotal());
//		ajaxResult.put("code", 200);
//		ajaxResult.put("msg", "查询成功");
		return getDataTable(pageResult.getRows());
	}

	/**
 	* 1.2 根据编号查询护理项目信息
 	* - 请求路径：/member/orders/project/{id}
 	* - 请求方式：GET
 	*/
	@GetMapping("/project/{id}")
	@ApiOperation("根据编号查询护理项目信息")
	public AjaxResult selectWxById(@PathVariable Long id){
		NursingProject nursingProject = nursingProjectService.selectNursingProjectById(id);
		return AjaxResult.success(nursingProject);
	}
}
